package com.metaera.app.ui.adapters;

import android.content.Context;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.metaera.app.R;
import com.metaera.app.data.model.NoticeListResponse;
import com.metaera.app.ui.activities.NotifyDetailsActivity;

import androidx.annotation.NonNull;

public class NoticeListAdapter extends BaseQuickAdapter<NoticeListResponse, BaseViewHolder> {

    public NoticeListAdapter() {
        super(R.layout.item_notice);

        setOnItemClickListener((a, view, position) ->{
            Context context = view.getContext();
            NoticeListResponse item = getItem(position);
            context.startActivity(NotifyDetailsActivity.newIntent(context, item.getTitle(), item.getDesc()));
        });
    }

    @Override
    protected void convert(@NonNull BaseViewHolder holder, NoticeListResponse item) {
        holder.setText(R.id.tv_notice_title, item.getTitle())
                .setText(R.id.tv_notice_date, item.getCreate_date());
    }

}
